package com.ldzl.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 采购申请表
 * @TableName sc_purchase_requisition
 */
@TableName(value ="sc_purchase_requisition")
@Data
public class ScPurchaseRequisition implements Serializable {
    /**
     * 采购申请的唯一ID，主键
     */
    @TableId(type = IdType.AUTO)
    private Long requisition_id;

    /**
     * 需要采购的物料/关联到物料信息表
     */
    private Long product_id;

    /**
     * 物料编码，允许存储以方便查询
     */
    private String product_code;

    /**
     * 物料名称，允许存储以方便查询
     */
    private String product_name;

    /**
     * 单位
     */
    private String material_unit;

    /**
     * 规格型号
     */
    private String material_sfn;

    /**
     * 父分类ID
     */
    private Long material_classification_id;

    /**
     * 子分类ID
     */
    private Long material_subcategory_id;

    /**
     * 采购单价
     */
    private BigDecimal material_purchasePrice;

    /**
     * 需求数量，即MRP计算的缺口数量
     */
    private BigDecimal required_quantity;

    /**
     * 期望到货日期，MRP会根据生产计划和采购提前期计算得出
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date required_date;

    /**
     * 建议的供应商ID，如果物料有主供应商，MRP可以自动填入
     */
    private Long suggested_vendor_id;

    /**
     * 申请状态 (例如: 采购中, 已完成)
     */
    private String status;

    /**
     * MRP运行批次号，用于追溯是哪一次MRP运算产生的此条申请
     */
    private String mrp_run_id;

    /**
     * 创建者，这里通常是系统自动填写为"MRP_SYSTEM"
     */
    private String create_by;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date create_time;

    /**
     * 更新人
     */
    private String update_by;

    /**
     * 更新时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date update_time;

    /**
     * 删除标志（0代表存在 1代表删除）
     */
    private String is_delete;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ScPurchaseRequisition other = (ScPurchaseRequisition) that;
        return (this.getRequisition_id() == null ? other.getRequisition_id() == null : this.getRequisition_id().equals(other.getRequisition_id()))
            && (this.getProduct_id() == null ? other.getProduct_id() == null : this.getProduct_id().equals(other.getProduct_id()))
            && (this.getProduct_code() == null ? other.getProduct_code() == null : this.getProduct_code().equals(other.getProduct_code()))
            && (this.getProduct_name() == null ? other.getProduct_name() == null : this.getProduct_name().equals(other.getProduct_name()))
            && (this.getMaterial_unit() == null ? other.getMaterial_unit() == null : this.getMaterial_unit().equals(other.getMaterial_unit()))
            && (this.getMaterial_sfn() == null ? other.getMaterial_sfn() == null : this.getMaterial_sfn().equals(other.getMaterial_sfn()))
            && (this.getMaterial_classification_id() == null ? other.getMaterial_classification_id() == null : this.getMaterial_classification_id().equals(other.getMaterial_classification_id()))
            && (this.getMaterial_subcategory_id() == null ? other.getMaterial_subcategory_id() == null : this.getMaterial_subcategory_id().equals(other.getMaterial_subcategory_id()))
            && (this.getMaterial_purchasePrice() == null ? other.getMaterial_purchasePrice() == null : this.getMaterial_purchasePrice().equals(other.getMaterial_purchasePrice()))
            && (this.getRequired_quantity() == null ? other.getRequired_quantity() == null : this.getRequired_quantity().equals(other.getRequired_quantity()))
            && (this.getRequired_date() == null ? other.getRequired_date() == null : this.getRequired_date().equals(other.getRequired_date()))
            && (this.getSuggested_vendor_id() == null ? other.getSuggested_vendor_id() == null : this.getSuggested_vendor_id().equals(other.getSuggested_vendor_id()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getMrp_run_id() == null ? other.getMrp_run_id() == null : this.getMrp_run_id().equals(other.getMrp_run_id()))
            && (this.getCreate_by() == null ? other.getCreate_by() == null : this.getCreate_by().equals(other.getCreate_by()))
            && (this.getCreate_time() == null ? other.getCreate_time() == null : this.getCreate_time().equals(other.getCreate_time()))
            && (this.getUpdate_by() == null ? other.getUpdate_by() == null : this.getUpdate_by().equals(other.getUpdate_by()))
            && (this.getUpdate_time() == null ? other.getUpdate_time() == null : this.getUpdate_time().equals(other.getUpdate_time()))
            && (this.getIs_delete() == null ? other.getIs_delete() == null : this.getIs_delete().equals(other.getIs_delete()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getRequisition_id() == null) ? 0 : getRequisition_id().hashCode());
        result = prime * result + ((getProduct_id() == null) ? 0 : getProduct_id().hashCode());
        result = prime * result + ((getProduct_code() == null) ? 0 : getProduct_code().hashCode());
        result = prime * result + ((getProduct_name() == null) ? 0 : getProduct_name().hashCode());
        result = prime * result + ((getMaterial_unit() == null) ? 0 : getMaterial_unit().hashCode());
        result = prime * result + ((getMaterial_sfn() == null) ? 0 : getMaterial_sfn().hashCode());
        result = prime * result + ((getMaterial_classification_id() == null) ? 0 : getMaterial_classification_id().hashCode());
        result = prime * result + ((getMaterial_subcategory_id() == null) ? 0 : getMaterial_subcategory_id().hashCode());
        result = prime * result + ((getMaterial_purchasePrice() == null) ? 0 : getMaterial_purchasePrice().hashCode());
        result = prime * result + ((getRequired_quantity() == null) ? 0 : getRequired_quantity().hashCode());
        result = prime * result + ((getRequired_date() == null) ? 0 : getRequired_date().hashCode());
        result = prime * result + ((getSuggested_vendor_id() == null) ? 0 : getSuggested_vendor_id().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getMrp_run_id() == null) ? 0 : getMrp_run_id().hashCode());
        result = prime * result + ((getCreate_by() == null) ? 0 : getCreate_by().hashCode());
        result = prime * result + ((getCreate_time() == null) ? 0 : getCreate_time().hashCode());
        result = prime * result + ((getUpdate_by() == null) ? 0 : getUpdate_by().hashCode());
        result = prime * result + ((getUpdate_time() == null) ? 0 : getUpdate_time().hashCode());
        result = prime * result + ((getIs_delete() == null) ? 0 : getIs_delete().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", requisition_id=").append(requisition_id);
        sb.append(", product_id=").append(product_id);
        sb.append(", product_code=").append(product_code);
        sb.append(", product_name=").append(product_name);
        sb.append(", material_unit=").append(material_unit);
        sb.append(", material_sfn=").append(material_sfn);
        sb.append(", material_classification_id=").append(material_classification_id);
        sb.append(", material_subcategory_id=").append(material_subcategory_id);
        sb.append(", material_purchasePrice=").append(material_purchasePrice);
        sb.append(", required_quantity=").append(required_quantity);
        sb.append(", required_date=").append(required_date);
        sb.append(", suggested_vendor_id=").append(suggested_vendor_id);
        sb.append(", status=").append(status);
        sb.append(", mrp_run_id=").append(mrp_run_id);
        sb.append(", create_by=").append(create_by);
        sb.append(", create_time=").append(create_time);
        sb.append(", update_by=").append(update_by);
        sb.append(", update_time=").append(update_time);
        sb.append(", is_delete=").append(is_delete);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}